﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wedn.Net.Model;

namespace Wedn.Net.Cache
{
    public class LinkCache : BaseCache<IDictionary<int,Link>>
    {
        public LinkCache() : base("LinkList", new object()) { }
        public override void RefreshData()
        {
            var list = BLLFactory.BLLFactory.Instance.LinkManager.Select(l => true).ToList();
            Data = new Dictionary<int, Link>();
            foreach (var item in list)
            {
                var temp = new Link();
                temp.Id = item.Id;
                temp.Text = item.Text;
                temp.Title = item.Title;
                temp.Rel = item.Rel;
                temp.Target = item.Target;
                temp.Order = item.Order;
                temp.Type = item.Type;
                temp.Url = item.Url;
                temp.Visible = item.Visible;
                temp.ParentId = item.ParentId;
                temp.Child = new List<Link>();
            }
        }
        
    }
}
